package com.suyang.syt.context;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.web.context.WebApplicationContext;

import com.suyang.syt.model.Dictionary;

public class BeanFactoryContext {

	private static WebApplicationContext webApplicationContext;
	private static String ctx;
	private static String realPath;
	private static String accessToken;
	private static Map<String, List<Dictionary>> dictionarys = new HashMap<String, List<Dictionary>>();

	private BeanFactoryContext() {

	}

	public static WebApplicationContext getWebApplicationContext() {
		return webApplicationContext;
	}

	public static void setWebApplicationContext(WebApplicationContext webApplicationContext) {
		BeanFactoryContext.webApplicationContext = webApplicationContext;
	}

	public static Object getService(String serviceName) {
		return webApplicationContext.getBean(serviceName);
	}

	public static String getCtx() {
		return ctx;
	}

	public static void setCtx(String ctx) {
		BeanFactoryContext.ctx = ctx;
	}

	public static String getRealPath() {
		return realPath;
	}

	public static void setRealPath(String realPath) {
		BeanFactoryContext.realPath = realPath;
	}

	public static String getAccessToken() {
		return accessToken;
	}

	public static void setAccessToken(String accessToken) {
		BeanFactoryContext.accessToken = accessToken;
	}

	public static Map<String, List<Dictionary>> getDictionarys() {
		return dictionarys;
	}

	public static void setDictionarys(Map<String, List<Dictionary>> dictionarys) {
		BeanFactoryContext.dictionarys = dictionarys;
	}

}
